import { NTree } from 'naive-ui'
import { useProTableState } from '@/components/pro-table/context.ts'

/**
 * @ClassName: setting-body
 * @Description: // 配置-内容部分
 * @Author: Ellwood
 * @CreateDate: 2024/2/27 - 8:20
 * @Version: V1.0.0
 */
const settingBody = defineComponent({
  name: 'SettingBody',
  setup() {
    /* const treeData = [
                                                  { label: 'Name', name: 'name' },
                                                  { label: 'Age', name: 'age' },
                                                ] */
    const state = useProTableState()
    return () => {
      const treeProps = {
        'onUpdate:checkedKeys': state?.settingColumns?.handleCheckedKeys,
      }
      return (
        <div class="py-6px">
          <NTree
            {...treeProps}
            data={state.settingColumns?.treeData?.value}
            checkedKeys={state.settingColumns?.checkedKeys?.value}
            checkable
            selectable={false}
          />
        </div>
      )
    }
  },
})

export default settingBody
